limsQualityRule.editPage = {

    getGridParam: function () {
        var _this = this;
        return {
            type: 'grid',
            id: 'lims-quality-rule-edit-list-grid',
            url: limsQualityRule.baseUrl + '/queries/raw',
            service: 'limsQualityRuleServiceImpl',
            dbTable: 'T_LIMS_QUALITY_RULE',
            columns: limsQualityRule.getEditListColumns(),
            deleteFormatter: function (row) {
                return row.ruleName;
            },
            onLoadSuccess: function (data) {
                if (!Gikam.isEmpty(data)) {
                    this.activeRowByIndex(0);
                }
            },
            requestData: {
                orderParams: [
                    {first: 'sort', second: 'asc'}
                ]
            },
            onRowActive: function (index, row) {
            },
            toolbar: [{
                type: 'button',
                text: 'GIKAM.BUTTON.INSERT',
                icon: 'add',
                onClick: function () {
                    Gikam.preInsert({
                        modalTitle: 'GIKAM.BUTTON.INSERT',
                        fields: limsQualityRule.getBaseInfoFormFields(),
                        url: limsQualityRule.baseUrl
                    }).done(function (id) {
                        Gikam.getComp('lims-quality-rule-edit-list-grid').refresh();
                    });
                }
            }, {
                type: 'button',
                text: 'GIKAM.BUTTON.DELETE',
                icon: 'remove-row',
                onClick: function () {
                    Gikam.getComp('lims-quality-rule-edit-list-grid').deleteRows(limsQualityRule.baseUrl);
                }
            }]
        }
    },

    create: function () {
        var _this = this;
        Gikam.create('layout', {
            id: 'lims-quality-rule-edit-list-layout',
            renderTo: workspace.window.$dom,
            center: {
                items: [_this.getGridParam()]
            }
        });
    },

    init: function () {
        this.create();
    }
};
